<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let hd = [
            { title: "TTTT1", lesson: 3 },
            { title: "QQQQ@", lesson: 4 },
            { title: "EEEEE3", lesson: 8 }
        ];

        // 对象时键名，数组是下标
        const obj = { title: "EEEEE3", lesson: 8 };

        for (const key in obj) {
            console.log(key);
            console.log(obj[key]);

        }

        // for (let i in hd) {
        //     console.log(i);
        //     console.log(hd[i]);
        // }


        // let hdr = ['wfj', 'll'];
        // for (let key in hdr) {
        //     console.log(key);
        //     console.log(hdr[key]);
        // }

        //for of 迭代对象
        for (const iterator of hd) {
            console.log(iterator.title);
        }
        for (const v of "hello") {
            console.log(v);
        }

    </script>
</body>

</html>